
let str = '' ;

for( let i = 1 ; i <= 1000 ; i++ ){
    let n = String(i) ; // number ---> string
    let s = n.padStart( 4 , '0' );
    str = str + s ; // 使用 + 运算符 拼接字符串
    if( n % 10 === 0 ){
        str += '\n'
    } else {
        str += '\t' ;
    }
}

console.log( str );

let s = '2' ;
let x = s.padEnd( 5 , '0' );

console.log( x );

console.log( '- - - - - - - - - - - - - - -' );

let slogan = '反清复明' ;
let sn = slogan.repeat( 5 );
console.log( sn );

console.log( '- - - - - - - - - - - - - - -' );

let ss = sn.replace( '清' , 'X' );
// let ss = sn.replaceAll( '清' , 'X' ); // 到浏览器端测试
console.log( ss );